package config

import (
	"common/helper"
	"database/sql"
)

/*
流水返利配置
*/

type CfgDailyRunningReturnItem struct {
	Running    float64 `json:"running" db:"running" cbor:"running"`
	ReturnRate int     `json:"return_rate" db:"return_rate" cbor:"return_rate"`
}
type CsDailyRunningReturnCfg struct{}

var cfgDailyList []CfgDailyRunningReturnItem

func (that *CsDailyRunningReturnCfg) GetCfg() []CfgDailyRunningReturnItem {
	return cfgDailyList
}

func (that *CsDailyRunningReturnCfg) removeAllCfg() {
	cfgDailyList = []CfgDailyRunningReturnItem{}
}

func DailyRunningReturnCfgRemove() {
	cfgDailyList = []CfgDailyRunningReturnItem{}
}

func DailyRunningReturnCfgSetRow(rows *sql.Rows) {
	var tVal CfgDailyRunningReturnItem
	var err error
	err = rows.Scan(&tVal.Running, &tVal.ReturnRate)
	if err != nil {
		helper.InfoLog("RunningReturnCfgSetRow,scan err")
		return
	}

	cfgDailyList = append(cfgDailyList, tVal)

}
